 const {Sequelize} = require('sequelize');
 const {MYSQL_CONF} = require('../conf/db')
 const {database,user,password} = MYSQL_CONF
 const sequelize = new Sequelize(database, user, password, {
     host: 'localhost',
     dialect: 'mysql',
     logging: false,                        // 禁用日志记录
 });

 // 测试连接
 try {
     sequelize.authenticate().then(() => {
         console.log('DB Connection has been established successfully.');
     })
 } catch (error) {
     console.error('Unable to connect to the database:', error);
 }

 module.exports = {
     sequelize
 }
